<div id="sidebar" role="complementary">

	<?php if(VPRO && pagelines('grandnav')) include(PRO.'/_grandchildnav.php');?>



	<?php if(get_post_meta($post->ID, 'secondary_sidebar', true)):?>
		<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('secondary_sidebar') ) : ?>
			<?php _e('The secondary sidebar has been selected but doesn\'t have any widgets. Add some widgets to your secondary sidebar in your admin.');?>
		<?php endif; ?>
	<?php else:?>
		<?php if(is_home() || pagelines('welcomeall')):?>
			<?php if(pagelines('greeting') || pagelines('welcomemessage')):?>
			<div id="welcome">
				<div class="welcometext">
				<?php if(pagelines('greeting')):?><h3 class="greeting"><?php echo pagelines('greeting');?></h3><?php endif;?>
				<?php if(pagelines('welcomemessage')):?><div class="welcomemessage"><?php echo pagelines('welcomemessage');?></div><?php endif;?>
				<div class="clear"></div>
				</div>
			</div>
			<?php endif;?>
		<?php endif;?>
		
			<?php if(VPRO && pagelines('showads')):?>
			<div id="ads" class="administer_widget widget">
				<div class="winner">
		         	<?php do_action('ad-minister', array('position' => 'Small Banner', 'limit' => 4)); ?>
					<?php if(pagelines('adslink')):?>
						<div class="adslink"><small><a href="<?php echo get_permalink(pagelines('adslink')); ?>"><?php _e('Learn More About Advertising Here');?></a></small></div>
					<?php endif;?>
				</div>
			</div>
			<?php endif;?>
			
		
		<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>
			<?php include(TEMPLATEPATH.'/_defaultsidebar.php');?>
		<?php endif; ?>
		
	<?php endif;?>
</div>

<?php include (TEMPLATEPATH . '/_contentfooter.php'); ?>